package com.ruoyi.coronary.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.coronary.mapper.CoronaryRecordMapper;
import com.ruoyi.coronary.domain.CoronaryRecord;
import com.ruoyi.coronary.service.ICoronaryRecordService;

/**
 * 诊疗单Service业务层处理
 *
 * @author wky
 * @date 2024-04-03
 */
@Service
public class CoronaryRecordServiceImpl implements ICoronaryRecordService
{
    @Autowired
    private CoronaryRecordMapper coronaryRecordMapper;

    /**
     * 查询诊疗单
     *
     * @param recordId 诊疗单主键
     * @return 诊疗单
     */
    @Override
    public CoronaryRecord selectCoronaryRecordByRecordId(Long recordId)
    {
        return coronaryRecordMapper.selectCoronaryRecordByRecordId(recordId);
    }

    /**
     * 查询诊疗单列表
     *
     * @param coronaryRecord 诊疗单
     * @return 诊疗单
     */
    @Override
    public List<CoronaryRecord> selectCoronaryRecordList(CoronaryRecord coronaryRecord)
    {
        return coronaryRecordMapper.selectCoronaryRecordList(coronaryRecord);
    }

    /**
     * 新增诊疗单
     *
     * @param coronaryRecord 诊疗单
     * @return 结果
     */
    @Override
    public int insertCoronaryRecord(CoronaryRecord coronaryRecord)
    {
        coronaryRecord.setCreateTime(DateUtils.getNowDate());
        coronaryRecord.setCreateBy(SecurityUtils.getUsername());
        return coronaryRecordMapper.insertCoronaryRecord(coronaryRecord);
    }

    /**
     * 修改诊疗单
     *
     * @param coronaryRecord 诊疗单
     * @return 结果
     */
    @Override
    public int updateCoronaryRecord(CoronaryRecord coronaryRecord)
    {
        return coronaryRecordMapper.updateCoronaryRecord(coronaryRecord);
    }

    /**
     * 批量删除诊疗单
     *
     * @param recordIds 需要删除的诊疗单主键
     * @return 结果
     */
    @Override
    public int deleteCoronaryRecordByRecordIds(Long[] recordIds)
    {
        return coronaryRecordMapper.deleteCoronaryRecordByRecordIds(recordIds);
    }

    /**
     * 删除诊疗单信息
     *
     * @param recordId 诊疗单主键
     * @return 结果
     */
    @Override
    public int deleteCoronaryRecordByRecordId(Long recordId)
    {
        return coronaryRecordMapper.deleteCoronaryRecordByRecordId(recordId);
    }
}
